function AjaxProxy() {
}

AjaxProxy.prototype = {
    getYearAndTravel: function(year) {
        var yearTravelString = null;
        $.ajax({
            url: pwc.path.getUrl("calendar/getyearAndTravel"),
            async: false,
            type: "POST",
            data: { year: year },
            cache: false,
            success: function(response) {
                yearTravelString = response;
            }
        });
        return yearTravelString;
    },
    getYearAndTravelAsync: function(year, callback) {
        $.ajax({
            url: pwc.path.getUrl("calendar/getyearAndTravel"),
            async: true,
            type: "POST",
            data: { year: year },
            cache: false,
            success: function(response) {
                callback(response);
            }
        });
    },

    saveMonths: function(monthsString) {
        $.ajax({
            url: pwc.path.getUrl("calendar/savemonths"),
            async: true,
            type: "POST",
            data: { monthsBody: monthsString },
            cache: false
        });
    },

    getTravelSteps: function(year) {
        var yearString = null;
        $.ajax({
            url: pwc.path.getUrl("calendar/gettravel"),
            async: false,
            type: "POST",
            data: { year: year },
            cache: false,
            success: function(response) {
                yearString = response;
            }
        });
        return yearString;
    },

    saveTravelSteps: function(travelSteps) {
        $.ajax({
            url: pwc.path.getUrl("calendar/savetravel"),
            async: true,
            type: "POST",
            data: { travelSteps: travelSteps },
            cache: false
        });
    },

    saveLastVistedMonthAsync: function(firstVisibleYearMonth, selectedYearMonth, callback) {
        $.ajax({
            url: pwc.path.getUrl("calendarsettings/savelastVistedMonth"),
            async: true,
            type: "POST",
            data: { firstVisibleYear: firstVisibleYearMonth.year, firstVisibleMonth: firstVisibleYearMonth.month,
                selectedYear: selectedYearMonth.year, selectedMonth: selectedYearMonth.month
            },
            cache: false,
            complete: function() {
                callback();
            }
        });
    }
};